import time
from core.tools.custom_requests import CustomRequests
from finance_c2c.local_settings import gdKey


class GdMapApi(CustomRequests):
    # 根据经纬度获取位置名称
    def code_regeo(self, location, radius=100, batch="false"):
        """
        :param location: 经纬度
        :param batch: 单点查询
        :param radius: 取值范围
        :return:
        """
        location = location
        params = {
            "key": gdKey,
            "location": location,
            "radius": radius,
            "roadlevel": 0,
            "batch": batch
        }
        url = "//restapi.amap.com/v3/geocode/regeo"
        response = self.get(url, params=params)
        return response


gd_map_api = GdMapApi()
